package org.brain.bean;

import java.sql.Timestamp;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;


import org.brain.dbo.DBOperate;
import org.brain.pojos.Userinfo;


@ManagedBean(name="userinfoBean")
@SessionScoped
public class UserinfoBean {
	private String userinfoid;
	private String userinfocareer;
	private Timestamp userinforegistertime;
	
	
	public String getUserinfoid() {
		return userinfoid;
	}
	public void setUserinfoid(String userinfoid) {
		this.userinfoid = userinfoid;
	}
	public String getUserinfocareer() {
		return userinfocareer;
	}
	public void setUserinfocareer(String userinfocareer) {
		this.userinfocareer = userinfocareer;
	}
	public Timestamp getUserinforegistertime() {
		return userinforegistertime;
	}
	public void setUserinforegistertime(Timestamp userinforegistertime) {
		this.userinforegistertime = userinforegistertime;
	}
	
	public void initUserinfo(){
		List list = DBOperate.search("Userinfo where userinfoid='"+userinfoid+"'");
				FacesContext facesContext = FacesContext.getCurrentInstance();
                ExternalContext extContext = facesContext.getExternalContext();
                extContext.getSession(true);
                Userinfo userinfo = (Userinfo) list.get(0);
                extContext.getSessionMap().put("userinfo",userinfo);
	}
	
}
